home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / D51_NARexx / Compare.dopus5 < prev    next >
Text File  |  1995-09-29  |  4KB  |  110 lines

  1. /* Compare for Directory Opus 5
  2.    By Leo Davidson ("Nudel", P0T-NOoDLE/Gods'Gift Utilities)
  3.  
  4. $VER: Compare.dopus5 1.3 (18.8.95)
  5.  
  6.    NOTE: This script _requires_ DOpus v5.11 or above.
  7.  
  8.    Using an external AmigaDOS compare program, this will compare either:
  9. a) the first two selected entries in the source lister (if more than one
  10.    entry is selected in the source lister), or,
  11. b) the selected entry in the source lister with the first selected entry
  12.    in the destination lister.
  13.  
  14. Where multiple soure/destination listers are open, only those listed
  15. first by DOpus5 will be used - so for the desired results you should
  16. only have one source and one destination lister (or just one source
  17. if you have two entries selected in it).
  18.  
  19. Note: Whether comparing two directories, or even a directory with a
  20.       file, works or not depends on the "Compare" command you use. This
  21.       script will send the selected ENTRIES (file OR dir!) to the command -
  22.       after this what happens is entirely up to the command itself!
  23.  
  24. Call as:
  25. ------------------------------------------------------------------------------
  26. ARexx    Compare.dopus5 {Qp}
  27. ------------------------------------------------------------------------------
  28. The "Output to window" and "Window close button" switches should both be on.
  29.  
  30. You should change the "Address Command..." line near the end to work with
  31. whatever Compare command you prefer to use (you'll at least have to change
  32. it's path).
  33.  
  34.    v1.01 -> v1.02 - Now uses stem variables for getting the lister handles.
  35.                     Also tidied up a couple of minor things.
  36.                     Now checks to make sure the DOPUS.x port exists.
  37.    v1.02 -> v1.3  - Now uses Show() instead of ShowList(). (Thanks Stoebi)
  38.                     Style Guide compliant version numbering and $VER string.
  39. */
  40.  
  41. /*-- Main Program -----------------------------------------------------------*/
  42. options results
  43. options FAILAT 99
  44. signal on syntax;signal on ioerr
  45. PARSE ARG DOpusPort
  46. DOpusPort = Strip(DOpusPort,"B",'" ')
  47.  
  48. If DOpusPort="" THEN Do
  49.     Say "Not correctly called from Directory Opus 5!"
  50.     Say "Load this ARexx script into an editor for more info."
  51.     EXIT
  52.     END
  53. If ~Show("P",DOpusPort) Then Do
  54.     Say DOpusPort "is not a valid port."
  55.     EXIT
  56.     End
  57. Address value DOpusPort
  58.  
  59. lister query source stem source_handle.
  60.  
  61. IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
  62.     dopus request '"You must have a SOURCE lister!" OK'
  63.     EXIT
  64.     End
  65.  
  66. lister query source_handle.0 numselentries
  67. If RESULT = 0 Then Do
  68.     dopus request '"You must have at least one entry' X2C(0A) 'selected in the SOURCE lister!" OK'
  69.     EXIT
  70.     End
  71.  
  72. lister query source_handle.0 firstsel
  73. First_Name = RESULT
  74. lister select source_handle.0 First_Name 0
  75. lister query source_handle.0 path
  76. First_Name = Strip(RESULT,"B",'"')||Strip(First_Name,"B",'"')
  77. lister refresh source_handle.0
  78.  
  79. lister query source_handle.0 numselentries
  80. drop source_handle.count
  81. If RESULT = 0 Then Do
  82.     lister query dest stem source_handle.
  83.     IF source_handle.count = 0 | source_handle.count = "SOURCE_HANDLE.COUNT" Then Do
  84.         dopus request '"If you do not select TWO entries in the SOURCE lister,' X2C(0A) 'you must have a DESTINTION lister as well!" OK'
  85.         EXIT
  86.         END
  87.     END
  88.  
  89. lister query source_handle.0 numselentries
  90. If RESULT = 0 Then Do
  91.     dopus request '"You must select a second entry in' X2C(0A) 'either the SOURE or DEST lister!" OK'
  92.     EXIT
  93.     END
  94.  
  95. lister query source_handle.0 firstsel
  96. Second_Name = RESULT
  97. lister select source_handle.0 Second_Name 0
  98. lister query source_handle.0 path
  99. Second_Name = Strip(RESULT,"B",'"')||Strip(Second_Name,"B",'"')
  100. lister refresh source_handle.0
  101.  
  102. Say 'Compare: "'First_Name'"'
  103. Say '   with: "'Second_Name'"'
  104. Say
  105.  
  106. Address Command 'DH0:Tools/System/Utils/Compare "' || First_Name || '" "' || Second_Name || '"'
  107.  
  108. syntax:;ioerr:                /* In case of error, jump here */
  109. EXIT
  110.